home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
United Public Domain Gold 2
/
United Public Domain Gold 2.iso
/
utilities
/
pu453.dms
/
pu453.adf
/
extras
/
basic_sources
/
pcqshell.bas
< prev
next >
Wrap
BASIC Source File
|
1992-11-08
|
34KB
|
1,149 lines
REM ** PCQ Pascal Shell - HiSoft Basic Revision - 17-12-1990 **
REM ** Rev.B Removes default window , Better file routines **
REM ** DAC 5-4-1991 **
REM ** Rev.C Arp Requester , MANY bugs fixed **
REM ** DAC 6-11-1992 **
REM $option Y+,B-,Frmd:pcqshell.run
LIBRARY "arp.library"
REM LIBRARY "dos.library"
DECLARE FUNCTION xopen& LIBRARY
DECLARE FUNCTION FileRequest& LIBRARY
DIM req&(7)
MENU 1,0,1,"Project"
MENU 1,1,1,"Load Source"
MENU 1,2,1,"Save Source"
MENU 1,3,1,"Save Object"
MENU 1,4,1,"Exit "
MENU 2,0,1,"Actions"
MENU 2,1,1,"Edit "
MENU 2,2,1,"Compile "
MENU 2,3,1,"Assemble"
MENU 2,4,1,"Link "
MENU 2,5,1,"C-A-L "
MENU 2,6,1,"Run prog"
MENU 3,0,1,"Extras "
MENU 3,1,1,"Cli-Command"
MENU 3,2,1,"Directory "
MENU 3,3,1,"Change font"
MENU 3,4,1,"Disk Free "
MENU 3,5,1,"Exec bckgrd"
MENU 3,6,1,"Avail. mem "
MENU 3,7,1,"Make Dir "
MENU 4,0,1,"Help Me! "
MENU 4,1,1,"About "
MENU 4,2,1,"Instructions"
MENU 4,3,1,"Extended dox"
MENU 4,4,1,"Auto Help "
MENU 4,5,1,"Contact .. "
MENU 5,0,1,"1-Meg + "
MENU 5,1,1,"Ram-Install"
ON MENU GOSUB menuhandler
MENU ON
ON BREAK GOSUB ed
BREAK ON
REM Create the capture file (to avoid needless bugging ..)
OPEN "O",#1,"rmd:capture":CLOSE #1
BEEP
SCREEN 2,640,256,2,2
WINDOW 2,"PCQ Pascal Shell by David A. Caruana",,0,2
PALETTE 0,.7,.7,.7 : PALETTE 1,0,0,0
PALETTE 2,1,1,1 : PALETTE 3,.4,.2,.9
scrn& = PEEKL(WINDOW(7)+46) : POKEW(scrn&+20),17
PRINT " __ __ __"
PRINT " | \ / / \ "
PRINT " | | | | | __ __ __ ____ __ "
PRINT " | | | | | | | / \ ( / / \ |"
PRINT " |__/ | | | | | | | \ | | | |"
PRINT " | | | | |__| +--+ \ | +--+ |"
PRINT " | | | \| | | | \ | | | |"
PRINT " | \___ \__/\_ | | | ____) \ ___ | | |____"
PRINT ""
PRINT " David Alan Caruana"
PRINT " PCQ Pascal Shell"
PRINT " For PCQ Pascal by ..."
PRINT " Patrick Quaid"
PRINT
PRINT " Program Log ..."
PRINT
PRINT "PCQShell>";
start:
GOTO start
END
REM ---------------- P R O C E D U R E S
SUB requester(greet$,dir$,file$,colr) STATIC
SHARED req&()
greet$=greet$+CHR$(0)
dir$=dir$+STRING$(354,0)
file$=file$+STRING$(32,0)
req&(0)=SADD(greet$)
req&(1)=SADD(file$)
req&(2)=SADD(dir$)
req&(3)=WINDOW(7)
req&(4)=2^28-2^29*(colr=1)
temp&=FileRequest&(VARPTR(req&(0)))
IF temp&=0 THEN file$=CHR$(0)
dir$=LEFT$(dir$,INSTR(dir$,CHR$(0))-1)
file$=LEFT$(file$,INSTR(file$,CHR$(0))-1)
END SUB
extend:
PRINT "Extensions"
FOR x = 1 TO 20 : PRINT : NEXT x
CLS
PRINT "PCQ Pascal Shell Extended Documentation"
PRINT ""
PRINT "You are using the November 1992 update of PCQ Pascal Shell by"
PRINT " -- David Alan Caruana --"
PRINT "Among the many enhancements are ..."
PRINT "- Support for arp.library requesters"
PRINT "- 3D alerts (WB2.0 style) even on WB1.3"
PRINT "- This version is compiled using HiSoft BASIC (not AC-BASIC)"
PRINT " i.e. it is smaller and it runs faster ..."
PRINT "- This version can work on systems with only 1 drive"
PRINT " i.e. Save/Load commands have been enhanced"
PRINT "- This version will also work on standard , unexpanded Amigas"
PRINT " (although 1 Meg or more memory + a good monitor are recommended"
PRINT "- This version is now distributable (previous version required major"
PRINT " changes to work on machines other than my own (!!)"
PRINT ""
PRINT " (Press a key for next page ...)"
WHILE INKEY$="":WEND
CLS
PRINT "PCQ Pascal Shell Extended Documentation : Continued"
PRINT
PRINT "Some Help For New Users"
PRINT "-----------------------"
PRINT "These are some tips I have gained by experience ... hope they"
PRINT "are helpful ....!!!"
PRINT "- NEVER mix integers and reals (floating point) in the same "
PRINT "mathematical statement . This means that if you multiply an integer"
PRINT "by a real , your proggy WON`T WORK ...."
PRINT "SOLUTION : Either keep everything real (or everything integer)"
PRINT "or else remember to convert all integers to real (store in a "
PRINT "temporary variable .... I think the format was "
PRINT "TEMP := FLOAT(INTG);"
PRINT "where TEMP is a floating point variable (declared as REAL) and"
PRINT "INTG is an integer . When multiplying , now use TEMP instead of"
PRINT "INTG and your problem is solved ... If you are having problems"
PRINT "with CONST - declared variables , remember that is you want "
PRINT "(for example) a floating 2 , the following works ..."
PRINT "CONST"
PRINT " inttwo = 2 ; { This is an integer 2 }"
PRINT " floattwo = 2.0; { And this is a floating }"
PRINT ""
PRINT "- PCQ Pascal accepts comments surrounded by curly brackets "
PRINT " i.e. { and } and NOT (* , *) (as on some mainframes)"
PRINT " To convert these , you should use the search and replace"
PRINT " available on most text editors ..."
PRINT ""
PRINT "Press a key for next page ..."
WHILE INKEY$="":WEND
CLS
PRINT "Running Programs"
PRINT "----------------"
PRINT ""
PRINT "Unless your program opens its own window , the Run Prog option"
PRINT "in the menu will not work well . To run the program in memory"
PRINT "(for test purposes) do the following ..."
PRINT "1 - Press [Left Amiga Key][N]"
PRINT "This will bring you to the workbench screen"
PRINT "2 - If there are any windows infront of the AmigaDOS window"
PRINT "push them back using the front-to-back gadget (gadget to the"
PRINT "left in top-right corner) . . . "
PRINT "3 - Click once within AmigaDOS window to activate it"
PRINT "4 - (at the 1> prompt) - type in "
PRINT "RMD:SOURCE"
PRINT "This will load in and run the compiled program from memory"
PRINT "5 - Press [Left Amiga Key][M] to restore the shell screen."
PRINT ""
PRINT "Handy Tip ..."
PRINT "To change the editor colors use [Amiga Key][2]"
PRINT ""
PRINT "The rest of the updates should be reasonably self explanatory"
PRINT ""
PRINT "***** I M P O R T A N T *****"
PRINT "If an alert etc. causes you to go to the workbench screen"
PRINT "press [left Amiga key][M] to bring back the PCQ-Shell screen"
PRINT "If required click once to activate it ..."
PRINT "Rev B , 5-4-1991 : That shouldn't happen again now (he he)"
PRINT "Press any key"
WHILE INKEY$="":WEND
CLS
PRINT "Enhanced LOAD/SAVE routines ..."
PRINT ""
PRINT "These are enhancements allowing PCQ Pascal to be used by"
PRINT "single drive owners ... Only LOAD and SAVE source have"
PRINT "been enhanced ... sorry! ... The SAVE OBJECT may work if"
PRINT "the C directory is assigned to ramdisk i.e."
PRINT "(CLI-Command) ASSIGN C: ram:"
PRINT "However , remember to reassign back C: to its original"
PRINT "position if you do not want some nasty surprises !!!"
PRINT "As a precaution , always save your source before running."
PRINT ""
PRINT "Changing the Temporaries Directory"
PRINT "PCQ Pascal Shell holds its temporaries in volume RMD:"
PRINT "You may edit the startup-sequence to place RMD: in any"
PRINT "folder , drive etc. For KCS Power PC Board users, RMD:"
PRINT "can be profitably placed in the KCS Ram Ramdisk (This "
PRINT "also frees quite-a-bit of memory .. "
PRINT ""
PRINT "Press any key"
WHILE INKEY$ = "" : WEND
CLS
PRINT "Rev B , 5-4-1991 : FileCheck routine"
PRINT "PCQ Pascal Shell now checks if a file exists (using DOS functions)"
PRINT "before attempting to load it resulting in many less crashes ."
PRINT "If you are a single drive user and the load routine still refuses"
PRINT "to work , try loading a small file (df0:s/startup-sequence is good)"
PRINT "from the PCQShell disk (do this only once per session to as to"
PRINT "'awake' AmigaDOS and then load your actual file . (the other "
PRINT "better solution is to buy an external drive ..)"
PRINT ""
PRINT "Rev C , 6-11-1992 : Arp Requester and 3D alerts"
PRINT "PCQ Pascal Shell now uses the arp file-requester for filenames."
PRINT "This means that arp.library must be in the libs: directory"
PRINT "of your boot-disk . "
PRINT "Alerts now have a nice 3D-look and when the program closes/opens"
PRINT "its screen, colors are reset OK ."
PRINT ""
PRINT "I hope you enjoy using this software and find it useful . At this"
PRINT "point I would like to give credit once again to P.C.Quaid for"
PRINT "programming a goody-goody Pascal Compiler .. Thanx!"
PRINT ""
PRINT "Programmed by David Alan Caruana"
PRINT ""
PRINT "Note to all lamers : HANDS OFF MY WORK YOU LOSERS !!"
RETURN
instructions:
PRINT "Instructions"
FOR x = 1 TO 20 : PRINT : NEXT x
PRINT "PCQ Pascal Shell Instructions"
PRINT
PRINT "Use the menus to access functions ..."
PRINT
PRINT "The first menu (project) is for load/save functions"
PRINT
PRINT "The second menu (actions) is the interesting menu ..."
PRINT "Functions are ..."
PRINT "EDIT - Edit pascal program in memory"
PRINT "COMPILE - Compile pascal program in memory"
PRINT "ASSEMBLE - Assemble program in memory"
PRINT "LINK - Link program in memory"
PRINT "C-A-L - Compile,Assemble and Link program in memory"
PRINT "Run Prog - Runs the program in memory (careful - save first!)"
PRINT
PRINT "The third menu provides some utilities (easy to use...)"
PRINT
PRINT "The fourth menu (HELP ME!) provides some information"
PRINT
PRINT
PRINT "Press a key ..."
WHILE INKEY$<>"":WEND
WHILE INKEY$="":WEND
FOR x = 1 TO 10 : PRINT "" : NEXT x
PRINT "TECHNICAL DOCUMENTATION"
PRINT
PRINT "Temporary filenames ..."
PRINT "Source code - RMD:source.p"
PRINT "Assembly source - RMD:source.a"
PRINT "Object code - RMD:source.o"
PRINT "Executable prog - RMD:source"
PRINT
PRINT "To run shell , type RUN SHELL/PCQSHELL.RUN"
PRINT
PRINT "RMD: is an identifier for the KCS Power-PC-Board Ramdisk"
PRINT
PRINT "To run on other systems ...(without KCS Board)"
PRINT "1-Meg-Plus systems : Rename the ramdisk (AmigaDOS v1.3) as RMD:"
PRINT "0.5-Meg-Systems :"
PRINT "Either -1 Rename a disk as RMD: and use for temporaries"
PRINT " or -2 Create a folder (any name) and assign RMD: to it..."
PRINT "eg. 1>Mkdir df1:temp"
PRINT " 1>assign RMD: df1:temp"
PRINT
PRINT "Press a key ..."
WHILE INKEY$<>"":WEND
WHILE INKEY$="":WEND
FOR x = 1 TO 10 : PRINT "" : NEXT x
PRINT "Further Information ..."
PRINT
PRINT "Contact me (David A. Caruana) if you have any problems"
PRINT "with this program. Please send a blank disk (preferably)"
PRINT "with some PD on it . All disks returned with new software!"
PRINT "If you like this program, please drop a mail."
PRINT "I am not asking for money! .. it's just to know where"
PRINT "my proggie has got to !!"
PRINT " ** NO PIRACY **"
PRINT ""
PRINT "For full documentation (of compiler), the source-codes for the "
PRINT "compiler and runtime library , documents for the Assembler"
PRINT "and linker etc. please buy the 'standard' PCQ Pascal from"
PRINT "any PD library . The version of compiler in this shell is"
PRINT "found on Fred Fish 339, but there is a newer version available"
PRINT "now .."
PRINT ""
PRINT "I would also like some contacts in the music scene !!"
PRINT ""
PRINT "Address :"
PRINT "Snail Mail E-Mail"
PRINT "'Blossom', dac%panther@carla.dist.unige.it"
PRINT " Acacia Str.,"
PRINT " San Gwann SGN03"
PRINT " M A L T A"
PRINT ""
PRINT "When writing please state version (Rev C) and where it"
PRINT "was bought / copied (which PD library)"
RETURN
about:
PRINT "About"
PRINT ""
PRINT ""
PRINT ""
PRINT
PRINT " P C Q P A S C A L"
PRINT " Shell environment"
PRINT
PRINT "PCQ Pascal programmed by ..... Patrick Quaid"
PRINT "Shell environment by ..... David Alan Caruana"
PRINT
PRINT "Address :"
PRINT "Snail Mail E-Mail"
PRINT "'Blossom', dac%panther@carla.dist.unige.it"
PRINT " Acacia Str.,"
PRINT " San Gwann SGN03"
PRINT " M A L T A"
PRINT
PRINT "Final version : 14 - 11 - 1990"
PRINT "New Update : 6 - 11 - 1992"
PRINT
RETURN
CLi:
PRINT "CLI - Command"
PRINT "Redirect output to RMD:CAPTURE"
INPUT cmmand$
GOSUB eexecute
RETURN
dir:
PRINT "Directory"
PRINT "Input drive identifier (Return - df0: , 1 - df1: etc.)"
INPUT df$
IF df$="" THEN df$="df0:"
IF df$="1" THEN df$="df1:"
IF df$="2" THEN df$="df2:"
IF df$="3" THEN df$="df3:"
cmmand$="DIR >rmd:capture "+df$+" opt A"
GOSUB eexecute
RETURN
font:
PRINT "Change font"
cmmand$="Gemfont >rmd:capture"
GOSUB eexecute
RETURN
dfree:
PRINT "Disk free space"
PRINT "Input drive identifier (return for df0:)"
INPUT df$
IF df$="" THEN df$="df0:"
cmmand$="dfree >rmd:capture "+df$
GOSUB eexecute
RETURN
exec:
PRINT "Run background task"
mes1$="Run a background"
mes2$="task ??? This will"
mes3$="slow CPU ....."
sel1$="Yes"
sel2$="No"
GOSUB alert
IF sel = 2 THEN RETURN
PRINT "PCQShell>Run background task"
PRINT "Input filename"
INPUT nme$
IF nme$="" THEN RETURN
cmmand$="RUN >rmd:capture "+nme$
GOSUB eexecute
RETURN
avail:
PRINT "Available Memory ..."
cmmand$="avail >rmd:capture"
GOSUB eexecute
RETURN
MaKDIR:
mes1$="Make a new directory"
mes2$=""
mes3$=""
sel1$="Go Ahead!"
sel2$="Nope .."
GOSUB alert
IF sel = 2 THEN RETURN
PRINT "Input name for directory ..."
INPUT nme$
IF nme$="" THEN RETURN
cmmand$="makedir "+nme$
GOSUB eexecute
RETURN
xedit:
PRINT "Edit Source"
cmmand$="PCQ_PASCAL:pcq/ed rmd:source.p"
WINDOW CLOSE 2 : REM get to workbench screen ...
SCREEN CLOSE 2
GOSUB eexecute
SCREEN 2,640,256,2,2 : REM restore our screen ...
WINDOW 2,"PCQ Pascal Shell by David Alan Caruana",,0,2
PALETTE 0,.7,.7,.7 : PALETTE 1,0,0,0
PALETTE 2,1,1,1 : PALETTE 3,.4,.2,.9
scrn& = PEEKL(WINDOW(7)+46) : POKEW(scrn&+20),17
RETURN
xrun:
PRINT "Execute program"
cmmand$="rmd:source"
WINDOW CLOSE 2
SCREEN CLOSE 2
GOSUB eexecute
SCREEN 2,640,256,2,2 : REM restore our screen ...
WINDOW 2,"PCQ Pascal Shell by David Alan Caruana",,0,2
PALETTE 0,.7,.7,.7 : PALETTE 1,0,0,0
PALETTE 2,1,1,1 : PALETTE 3,.4,.2,.9
scrn& = PEEKL(WINDOW(7)+46) : POKEW(scrn&+20),17
CLS
PRINT "For CLI based programs , go to the CLI (use [Amiga][M]) and"
PRINT "enter the command RMD:Source at the prompt so as to run program"
PRINT "directly ."
RETURN
compile:
PRINT "COMPILE"
PRINT "Compiling , please wait ..."
IF raminst THEN
CHDIR "rmd:"
ELSE
CHDIR "PCQ_PASCAL:PCQ"
END IF
cmmand$="PASCAL >rmd:capture rmd:source.p rmd:source.a"
flag=1:GOSUB eexecute
PRINT "Compilation finished"
RETURN
assemble:
PRINT "ASSEMBLE"
PRINT "Assembling , please wait ..."
IF raminst THEN
CHDIR "rmd:"
ELSE
CHDIR "PCQ_PASCAL:PCQ"
END IF
cmmand$="A68K >rmd:capture rmd:source.a rmd:source.o"
GOSUB eexecute
PRINT "Program Assembled"
RETURN
link:
PRINT "LINK"
PRINT "Linking , please wait ..."
IF raminst THEN
CHDIR "rmd:"
ELSE
CHDIR "PCQ_PASCAL:PCQ"
END IF
cmmand$="BLINK >rmd:capture rmd:source.o to rmd:source library PCQ.lib"
GOSUB eexecute
PRINT "Program Linked - Executable program is in memory ! "
RETURN
cal:
PRINT "Compile-Assemble-Link"
GOSUB compile
GOSUB assemble
GOSUB link
RETURN
xsaveobject:
mes1$="Save PASCAL object file"
mes2$="(saves an executable file)"
mes3$=""
sel1$="PROCEED"
sel2$="BAIL OUT"
GOSUB alert
IF sel = 2 THEN RETURN
CLS
PRINT "Current filename :";
IF filename$<>"" THEN PRINT filename$ ELSE PRINT "NO NAME";" ";
sve$=filename$
IF UCASE$(RIGHT$(sve$,2))=".P" THEN
l = LEN(sve$) - 2
sve$ = LEFT$(sve$,l)
END IF
IF sve$<>"" THEN PRINT "Object filename is :";sve$
requester "Save Executable",dr3$,filename2$,0
IF dr3$<>"" AND RIGHT$(dr3$,1)<>":" THEN
filename2$ = dr3$ + "/" + filename2$
ELSE
filename2$ = dr3$ + filename2$
END IF
IF filename2$<>"" THEN sve$=filename2$
IF sve$="" THEN PRINT "NO FILENAME - SAVE ABORTED" : RETURN
REM ***************** ENHANCEMENT ***************
flag99 = 0
FOR x99 = 1 TO LEN(sve$)
IF MID$(sve$,x99,1)=":" THEN flag99 = 1
NEXT x99
sel = 0
IF flag99 = 0 THEN
mes1$="Save Executable"
mes2$="Select Disk Drive"
mes3$="To save to"
sel1$="Df0:"
sel2$="Df1:"
sel = 0
GOSUB alert
IF sel = 1 THEN sve$ = "df0:"+sve$
IF sel = 2 THEN sve$ = "df1:"+sve$
END IF
cmmand$= "copy PCQ_Pascal:c/copy rmd:copy"
GOSUB eexecute
mes1$="Save Pascal Object "
mes2$="Place object disk "
IF sel = 1 THEN mes3$="in internal drive ... " ELSE mes3$="in disk drive "
sel1$="OKEY"
sel2$="DOKEY"
GOSUB alert
REM *********************************************
PRINT "Saving ..."
cmmand$ = "rmd:COPY >RMD:Capture rmd:SOURCE "+sve$
GOSUB eexecute
RETURN
xsavesource:
mes1$="Save PASCAL source file"
mes2$=""
mes3$=""
sel1$="PROCEED"
sel2$="BAIL OUT"
GOSUB alert
IF sel = 2 THEN RETURN
PRINT "Current filename :";
IF filename$<>"" THEN PRINT filename$ ELSE PRINT "NO NAME"
filename2$ = ""
requester "Save Source",dr2$,filename2$,0
IF filename2$<>"" THEN
IF dr2$<>""
IF RIGHT$(dr2$,1)=":" THEN
filename$=dr2$+filename2$
ELSE
filename$=dr2$+"/"+filename2$
END IF
END IF
END IF
IF filename$="" THEN PRINT "NO FILENAME - SAVE ABORTED" : RETURN
REM ***************** ENHANCEMENT ***************
flag99 = 0
FOR x99 = 1 TO LEN(filename$)
IF MID$(filename$,x99,1)=":" THEN flag99 = 1
NEXT x99
sel = 0
IF flag99 = 0 THEN
mes1$="Save Pascal Source"
mes2$="Select Disk Drive"
mes3$="To save to"
sel1$="Df0:"
sel2$="Df1:"
sel = 0
GOSUB alert
IF sel = 1 THEN filename$ = "df0:"+filename$
IF sel = 2 THEN filename$ = "df1:"+filename$
END IF
cmmand$= "copy PCQ_Pascal:c/copy rmd:copy"
GOSUB eexecute
mes1$="Save Pascal Source "
mes2$="Place Source disk "
IF sel = 1 THEN mes3$="in internal drive ... " ELSE mes3$="in disk drive "
sel1$="OKEY"
sel2$="DOKEY"
GOSUB alert
REM *********************************************
PRINT "Saving ..."
REM **** Enhanced Save Routine
GOTO enhances:REM Remove this line to disable enhanced save
cmmand$ = "rmd:COPY >RMD:Capture rmd:SOURCE.p "+filename$
GOSUB eexecute
RETURN
enhances:
REM *** This is a simple line-copy routine ... ***
PRINT "Enhanced Save Activated"
PRINT "Opening ";filename$
OPEN "O",#1,filename$
PRINT "Opening rmd:source.p"
OPEN "I",#2,"rmd:source.p"
WHILE EOF(2)=0
LINE INPUT #2,al$
PRINT #1,al$
WEND
CLOSE #1
CLOSE #2
RETURN
xloadsource:
mes1$="Load new PASCAL source file"
mes2$="This will erase current file"
mes3$="permanently ... "
sel1$="PROCEED"
sel2$="BAIL OUT"
GOSUB alert
IF sel = 2 THEN RETURN
REM De-Rem next two commands when installing 'normal' loader
REM cmmand$= "copy PCQ_Pascal:c/copy rmd:copy"
REM GOSUB eexecute
CLS
PRINT "Input source filename ..."
filename$ = ""
requester "Load Source",dr$,filename$,0
IF RIGHT$(dr$,1)<>":" AND dr$<>"" THEN
filename$ = dr$ + "/" + filename$
ELSE
filename$ = dr$ + filename$
END IF
dr$ = dir$
flag99 = 0
FOR x99 = 1 TO LEN(filename$)
IF MID$(filename$,x99,1)=":" THEN flag99 = 1
NEXT x99
sel = 0
IF flag99 = 0 THEN
mes1$="Load Pascal Source"
mes2$="Select Disk Drive"
mes3$="To load from"
sel1$="Df0:"
sel2$="Df1:"
GOSUB alert
IF sel = 1 THEN filename$ = "df0:"+filename$
IF sel = 2 THEN filename$ = "df1:"+filename$
END IF
mes1$="Load Pascal Source "
mes2$="Place Source disk "
IF sel = 1 THEN mes3$="in internal drive . " ELSE mes3$="in disk drive"
sel1$="OKEY"
sel2$="DOKEY"
GOSUB alert
PRINT "Loading ..."
REM ******* Enhance Loader - Single Drive version ... ******
GOTO enhance : REM Remove this line to leave normal loader
CHDIR "rmd:"
cmmand$ = "COPY "+filename$+" rmd:SOURCE.p"
GOSUB eexecute
RETURN
enhance:
REM *** This is a simple line-copy routine ... ***
PRINT "Enhanced Load Activated"
checkfile filename$,chk
IF chk <> 0 THEN
PRINT "File : ";filename$
PRINT "File not found - Try another filename .."
RETURN
END IF
OPEN "I",#1,filename$
OPEN "O",#2,"rmd:source.p"
WHILE EOF(1)=0
LINE INPUT #1,al$
PRINT #2,al$
WEND
CLOSE #1
CLOSE #2
RETURN
SUB checkfile(filename$,chk) STATIC
REM Test if File exists , enhancement , 5-4-1991 , DAC
f$ = filename$+CHR$(0) :REM Name of file
fh& = xopen&(SADD(f$),1005&) :REM Use DOS Open file command
IF fh& = 0 THEN
chk = 1
ELSE
chk = 0 :REM All is OK
CALL xclose&(fh&)
END IF
END SUB
special:
REM --- Handle output from compiler
WHILE NOT EOF(1)
LINE INPUT #1,a$
IF UCASE$(LEFT$(a$,4))="LINE" THEN
PRINT a$
IF INKEY$<>"" THEN
WHILE INKEY$="":WEND
END IF
END IF
WEND
PRINT a$
flag = 0
RETURN
eexecute:
REM run cmmand$
CALL execute(SADD(cmmand$+CHR$(0)),0,0)
OPEN "RMD:capture" FOR INPUT AS #1
IF flag = 1 THEN GOSUB special
WHILE NOT EOF(1)
LINE INPUT #1,a$
PRINT a$
IF INKEY$<>"" THEN
WHILE INKEY$="":WEND
END IF
WEND
CLOSE #1
OPEN "O",#1,"rmd:capture":CLOSE #1
RETURN
menuhandler:
menuid = MENU(0)
menuitem = MENU(1)
IF helpon THEN GOSUB autohelp : RETURN
IF menuid = 1 AND menuitem = 1 THEN GOSUB xloadsource
IF menuid = 1 AND menuitem = 2 THEN GOSUB xsavesource
IF menuid = 1 AND menuitem = 3 THEN GOSUB xsaveobject
IF menuid = 1 AND menuitem = 4 THEN GOSUB ed
IF menuid = 2 AND menuitem = 1 THEN GOSUB xedit
IF menuid = 2 AND menuitem = 2 THEN GOSUB compile
IF menuid = 2 AND menuitem = 3 THEN GOSUB assemble
IF menuid = 2 AND menuitem = 4 THEN GOSUB link
IF menuid = 2 AND menuitem = 5 THEN GOSUB cal
IF menuid = 2 AND menuitem = 6 THEN GOSUB xrun
IF menuid = 3 AND menuitem = 1 THEN GOSUB CLi
IF menuid = 3 AND menuitem = 2 THEN GOSUB dir
IF menuid = 3 AND menuitem = 3 THEN GOSUB font
IF menuid = 3 AND menuitem = 4 THEN GOSUB dfree
IF menuid = 3 AND menuitem = 5 THEN GOSUB exec
IF menuid = 3 AND menuitem = 6 THEN GOSUB avail
IF menuid = 3 AND menuitem = 7 THEN GOSUB MaKDIR
IF menuid = 4 AND menuitem = 1 THEN GOSUB about
IF menuid = 4 AND menuitem = 2 THEN GOSUB instructions
IF menuid = 4 AND menuitem = 3 THEN GOSUB extend
IF menuid = 4 AND menuitem = 4 THEN GOSUB autohelp:RETURN
IF menuid = 4 AND menuitem = 5 THEN GOSUB contact
IF menuid = 5 AND menuitem = 1 THEN GOSUB raminstall
PRINT "PCQShell>";
RETURN
contact:
PRINT "Contact"
PRINT ""
PRINT "If you would like more info etc. on this program , why not"
PRINT "buy the full distribution disk . To do this , contact any "
PRINT "PD library supplying the FISH disks and ask for Fish 339"
PRINT ""
PRINT "If you would like to contact me for any reason , my address is:"
PRINT ""
PRINT "David Alan Caruana"
PRINT " 'Blossom',"
PRINT " Acacia Str,"
PRINT " San Gwann"
PRINT " M A L T A"
PRINT ""
PRINT "I hope you enjoy PCQ pascal as much as I did !!"
RETURN
autohelp:
IF NOT helpon THEN
mes1$ = " Activate "
mes2$ = " Auto-Help "
mes3$ = " mode ? "
sel1$ = "YES"
sel2$ = "NOPE"
GOSUB alert
IF sel = 2 THEN
PRINT "PCQShell>";
RETURN
END IF
helpon = -1
CLS
PRINT "*** PCQ Pascal Shell - AutoHelp ***"
PRINT "Select any menu item for help on it"
PRINT "Select Auto Help menu again to return"
PRINT "to normal operating mode .."
PRINT "AutoHelp>";
RETURN
END IF
IF menuid = 1 AND menuitem = 1 THEN GOSUB hxloadsource
IF menuid = 1 AND menuitem = 2 THEN GOSUB hxsavesource
IF menuid = 1 AND menuitem = 3 THEN GOSUB hxsaveobject
IF menuid = 1 AND menuitem = 4 THEN GOSUB hed
IF menuid = 2 AND menuitem = 1 THEN GOSUB hxedit
IF menuid = 2 AND menuitem = 2 THEN GOSUB hcompile
IF menuid = 2 AND menuitem = 3 THEN GOSUB hassemble
IF menuid = 2 AND menuitem = 4 THEN GOSUB hlink
IF menuid = 2 AND menuitem = 5 THEN GOSUB hcal
IF menuid = 2 AND menuitem = 6 THEN GOSUB hxrun
IF menuid = 3 AND menuitem = 1 THEN GOSUB hCLi
IF menuid = 3 AND menuitem = 2 THEN GOSUB hdir
IF menuid = 3 AND menuitem = 3 THEN GOSUB hfont
IF menuid = 3 AND menuitem = 4 THEN GOSUB hdfree
IF menuid = 3 AND menuitem = 5 THEN GOSUB hexec
IF menuid = 3 AND menuitem = 6 THEN GOSUB havail
IF menuid = 3 AND menuitem = 7 THEN GOSUB hMaKDIR
IF menuid = 4 AND menuitem = 1 THEN GOSUB habout
IF menuid = 4 AND menuitem = 2 THEN GOSUB hinstructions
IF menuid = 4 AND menuitem = 3 THEN GOSUB hextend
IF menuid = 4 AND menuitem = 4 THEN GOSUB xautohelp
IF menuid = 4 AND menuitem = 5 THEN GOSUB hcontact
IF menuid = 5 AND menuitem = 1 THEN GOSUB hraminstall
RETURN
xautohelp:
PRINT "AutoHelp is now disactivated"
PRINT "PCQShell>";
helpon = 0
RETURN
hcontact:
PRINT "Gives my address !!"
PRINT "AutoHelp>";
RETURN
hraminstall:
PRINT "Ram Install"
PRINT "If you have at least 1.5 megs memory or you are using"
PRINT "a KCS Power PC Board ramdisk , you may copy the compiler,"
PRINT "assembler , linker and library files to ramdisk for "
PRINT "quicker compilation . Remember that the include"
PRINT "files still remain in the directory Pcq_Pascal:pcq/includes/"
PRINT "AutoHelp>";
RETURN
hextend:
PRINT "Extend Dox"
PRINT "Gives information on some new program features"
PRINT "AutoHelp>";
RETURN
hinstructions:
PRINT "Gives instructions on using this program"
PRINT "AutoHelp>";
RETURN
habout:
PRINT "Gives info on this program .."
PRINT "AutoHelp>";
RETURN
hmakdir:
PRINT "Make Dir"
PRINT "Makes new sub directories on disk . Simply specify name .."
PRINT "AutoHelp>";
RETURN
havail:
PRINT "Avail. mem"
PRINT "Shows available memory , chipram , fastram and total"
PRINT "including the max. amount of memory and the largest"
PRINT "contiguous memory block."
PRINT "AutoHelp>";
RETURN
hexec:
PRINT "Execute Back."
PRINT "Runs a background task . Eats memory and processor time"
PRINT "so beware !! Similar to CLI in usage ."
PRINT "AutoHelp>";
RETURN
hdfree:
PRINT "Disk Free"
PRINT "Gives number of bytes free on disk . Enter either drive"
PRINT "number or drive identifier"
PRINT "AutoHelp>";
RETURN
hfont:
PRINT "Change Font"
PRINT "Replaces the system font with GEM-FONT , a smaller and"
PRINT "neater font . If you want the system font back , select"
PRINT "again .. "
PRINT "AutoHelp>";
RETURN
hdir:
PRINT "Directory"
PRINT "Gives directories of disks . You may enter either nothing"
PRINT "(directory of Df0:) , the drive number or the subdirectory"
PRINT "which you want to list ."
PRINT "AutoHelp>";
RETURN
hcli:
PRINT "CLI Command"
PRINT "Runs a CLI command from within the shell . Redirect"
PRINT "the output to the file RMD:Capture . If the output"
PRINT "is not redirected , it will finish up in the original"
PRINT "CLI window !!"
PRINT "AutoHelp>";
RETURN
hxrun:
PRINT "Run Prog"
PRINT "Runs the program in memory . Unless the program opens its"
PRINT "own window , the only effect produced will be an error"
PRINT "message in the CLI window . If you see that nothing happens"
PRINT "when selecting RUN PROG , go to the CLI (Press [Amiga][M])"
PRINT "click the CLI , press RETURN and at the CLI prompt type "
PRINT "RUN Rmd:Source . Your program should then run.."
PRINT "AutoHelp>";
RETURN
hcal:
PRINT "C-A-L"
PRINT "Compiles , assembles and links a file in memory"
PRINT "(saves selecting the individual items)"
PRINT "AutoHelp>";
RETURN
hlink:
PRINT "Link"
PRINT "Links the PCQ.Lib library of functions to the object"
PRINT "module making a complete executable file . The filename"
PRINT "of the executable is RMD:Source"
PRINT "AutoHelp>";
RETURN
hassemble:
PRINT "Assemble"
PRINT "Assembles the assembly module made by the compiler."
PRINT "Rmd:Source.a assembles to Rmd:Source.o , the unlinked"
PRINT "object module . The assembler is A68k by Brian R."
PRINT "Anderson and Charlie Gibbs"
PRINT "AutoHelp>";
RETURN
hcompile:
PRINT "Compile"
PRINT "Compiles the source code in memory (RMD:Source.p) producing"
PRINT "an assembly module (RMD:Source.a) . The compiler is PCQ Pascal"
PRINT "version 1.1 by Patrick C. Quaid . "
PRINT "AutoHelp>";
RETURN
hxedit:
PRINT "EDIT"
PRINT "Loads the editor and the source file in ramdisk . Any "
PRINT "editor may be used . I have included TxED which is quite"
PRINT "good and comes in a small file! Before exiting , select"
PRINT "Save File ([Right Amiga][W]) and save the file to RMD:Source.p"
PRINT "(this should be the default filename) then press [Right Amiga][Q]"
PRINT "to quit . NOTE : Use [Amiga][1] to change the screen colors"
PRINT "within the editor"
PRINT "AutoHelp>";
RETURN
hed:
PRINT "QUIT"
PRINT "This menu option quits the PCQ Pascal Shell (simple , eh!)"
PRINT "AutoHelp>";
RETURN
hxloadsource:
PRINT "Load Source"
PRINT "This command loads the source-file into memory"
PRINT "This is done by simply copying the required file"
PRINT "into the file RMD:source.p , where RMD: is the"
PRINT "name assigned to your ramdisk . Since REV B of "
PRINT "version 1 , the existence of the file is checked"
PRINT "before loading and the drive from which to load"
PRINT "is also requested (is not specified in filename)"
PRINT "The enhanced load should also cater for users"
PRINT "with only one drive , however if you still have"
PRINT "trouble I recommend deleting the EXAMPLE files from"
PRINT "a copy of your PCQ_Pascal disk and saving your "
PRINT "sources in that directory ."
PRINT "AutoHelp>";
RETURN
hxsavesource:
PRINT "Save Source"
PRINT "This command copies the temporary source file"
PRINT "in your ramdisk back to a floppy for permanent"
PRINT "storage . Default filenames etc. are supported"
PRINT "The procedure is similar to that for loading but"
PRINT "in reverse !"
PRINT "AutoHelp>";
RETURN
hxsaveobject:
PRINT "Save Object"
PRINT "This command saves your object file back to a floppy"
PRINT "The file is executable from CLI , but has no icon "
PRINT "If you want that , make one yourself ! If this command"
PRINT "fails to work (1-Drive users) you must go to the CLI"
PRINT "(press [Left Amiga][M]) and copy the file RMD:Source"
PRINT "to the appropriate executable name ."
PRINT "AutoHelp>";
RETURN
raminstall:
mes1$ = "Install Compiler"
mes2$ = "in ramdisk ?"
mes3$ = "(Req. 1.5 Meg)"
sel1$ = "Go On"
sel2$ = "Abort"
GOSUB alert
IF sel = 2 THEN RETURN
PRINT "PCQShell> Ram Install"
PRINT ".. Please Wait .."
cmmand$ = "PCQ_Pascal:c/copy pcq_pascal:pcq/pascal rmd:pascal"
PRINT "Copying Compiler .. ";
GOSUB eexecute
PRINT "Ready"
cmmand$ = "PCQ_Pascal:c/copy pcq_pascal:pcq/a68k rmd:a68k"
PRINT "Copying Assembler .. ";
GOSUB eexecute
PRINT "Ready"
cmmand$ = "PCQ_Pascal:c/copy pcq_pascal:pcq/blink rmd:blink"
PRINT "Copying Linker .. ";
GOSUB eexecute
PRINT "Ready"
cmmand$ = "PCQ_Pascal:c/copy pcq_pascal:pcq/pcq.lib rmd:pcq.lib"
PRINT "Copying Library file .. ";
GOSUB eexecute
PRINT "Ready"
raminst = -1
PRINT "PCQ Pascal Installed in Ramdisk .."
RETURN
ed:
mes1$="Do you really want"
mes2$="to exit ???"
sel1$="Yes"
sel2$="Nope"
GOSUB alert
IF sel = 2 THEN RETURN
WINDOW CLOSE 2
SCREEN CLOSE 2
END
RETURN
alert:
CLS
l1 = LEN(mes1$)
l2 = LEN(mes2$)
l3 = LEN(mes3$)
l = l1 : IF l2 > l THEN l = l2 : IF l3 > l THEN l = l3
boxw = (l*8)+16
boxh = (5*8)+16
boxx = (600 - boxw)/2
boxy = (240 - boxh)/2
textx = boxx/8
texty = boxy/8
LOCATE texty+0,textx : PRINT mes1$
PRINT TAB(textx);mes2$
PRINT TAB(textx); mes3$
sel1tx = textx
sel2tx = (l - LEN(sel2$))+textx
LOCATE texty+4,sel1tx : PRINT sel1$
LOCATE texty+4,sel2tx : PRINT sel2$
sel1xs = (sel1tx*8)-16
sel1xe = sel1xs + (LEN(sel1$)*8) + 16
sel2xs = (sel2tx*8)-16
sel2xe = sel2xs + (LEN(sel2$)*8) + 16
selys = ((texty+4)*8)-8
selye = ((texty+4)*8)+8
LINE (sel1xs,selys)-(sel1xe,selys),2
LINE (sel1xs,selys)-(sel1xs,selye),2
LINE (sel1xe,selys)-(sel1xe,selye),1
LINE (sel1xs,selye)-(sel1xe,selye),1
LINE (sel2xs,selys)-(sel2xe,selys),2
LINE (sel2xs,selys)-(sel2xs,selye),2
LINE (sel2xe,selys)-(sel2xe,selye),1
LINE (sel2xs,selye)-(sel2xe,selye),1
LINE (boxx-24,boxy-8)-(boxx-8+boxw,boxy-8),2
LINE (boxx-24,boxy-8)-(boxx-24,boxy-8+boxh),2,b
LINE (boxx-8+boxw,boxy-8)-(boxx-8+boxw,boxy-8+boxh),1,b
LINE (boxx-24,boxy-8+boxh)-(boxx-8+boxw,boxy-8+boxh),1,b
retry:
WHILE MOUSE(0)<>0:WEND
WHILE MOUSE(0)=0:WEND
x = MOUSE(1):y = MOUSE(2)
IF y<selys OR y>selye THEN GOTO retry
sel = 0
IF x>sel1xs AND x<sel1xe THEN sel = 1
IF x>sel2xs AND x<sel2xe THEN sel = 2
IF sel = 0 THEN GOTO retry
CLS
mes1$=" "
mes2$=" "
mes3$=" "
sel1$=" "
sel2$=" "
RETURN